﻿// -------------------------------------------------------------------------
//    @FileName         :    NFRetrivePart.cpp
//    @Author           :    gaoyi
//    @Date             :    24-8-30
//    @Email            :    445267987@qq.com
//    @Module           :    NFRetrivePart
//
// -------------------------------------------------------------------------

#include "NFRetrivePart.h"

#include "proto_cs_login.pb.h"
#include "proto_db.pb.h"

NFRetrivePart::NFRetrivePart()
{
    if (EN_OBJ_MODE_INIT == NFShmMgr::Instance()->GetCreateMode())
    {
        CreateInit();
    }
    else
    {
        ResumeInit();
    }
}

NFRetrivePart::~NFRetrivePart()
{
}

int NFRetrivePart::CreateInit()
{
    return 0;
}
    
int NFRetrivePart::ResumeInit()
{
    return 0;
}

int NFRetrivePart::LoadFromDB(const proto_ff::tbRoleDetail *pDBData)
{
    m_stData.FromPb(pDBData->role_fortune_data().retrive_data());
    return 0;
}

int NFRetrivePart::InitConfig(proto_ff::tbRoleDetail *pDbData, const RoleOne &stRoleOne)
{
    CHECK_NULL(0, pDbData);
    auto pData = pDbData->mutable_role_fortune_data()->mutable_retrive_data();
    CHECK_NULL(0, pData);

    pData->set_last_update_time(NF_ADJUST_TIMENOW());

    return 0;
}

int NFRetrivePart::SaveDB(proto_ff::tbRoleDetail *pDBData)
{
    m_stData.ToPb(pDBData->mutable_role_fortune_data()->mutable_retrive_data());
    return 0;
}

int NFRetrivePart::MakePlayerDataCS(proto_ff::Proto_CSGetRoleRsp* pCSGetRoleRsp)
{
    m_stData.ToPb(pCSGetRoleRsp->mutable_retrival_data());
    return 0;
}

int NFRetrivePart::MakeCityPlayerData(proto_ff::CityRoleInfo* pGCCityRoleInfo)
{
    return 0;
}
